import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import sklearn.linear_model as lm
import sklearn.preprocessing as sp
import sklearn.pipeline as pl


data = pd.read_csv('../data_test/Salary_Data.csv')
train_x = data.iloc[:,:-1]
train_y = data.iloc[:,-1]
model = pl.make_pipeline(sp.PolynomialFeatures(3),
                         lm.LinearRegression())
model.fit(train_x,train_y)
pred_train_y = model.predict(train_x)

plt.scatter(train_x,train_y,color = 'dodgerblue',s=50)
plt.plot(train_x,pred_train_y,color='orangered')
plt.show()